import java.util.Arrays;
import java.util.Scanner;

// 注意类名必须为 Main, 不要有任何 package xxx 信息
public class Main1 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        // 注意 hasNext 和 hasNextLine 的区别
        int n = in.nextInt();
        int[] a = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = in.nextInt();
        }
        Arrays.sort(a);
        int target = a[0] * 2;
        int count = 0;
        for (int i = n - 1; i >= 0; i--) {
            // 要保证max <= target
            if (a[i] > target) {
                count = func(a[i], target);
            } else {
                break;
            }
        }
        System.out.println(count);

    }

    /**
     * 返回使 max <= target 达到的最小操作次数
     * @param max
     * @param target
     * @return
     */
    private static int func(int max, int target) {
        if (max <= target) return 0;
        return func(max / 2, target) + func(max - max / 2, target) + 1;
    }
}